<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>if.html</title>
<script>
function chk() {
 		var s = document.getElementById("su");
 		if(s.value>=18){
 			alert("입장가능합니다.");
 			
 		}else{
 			alert("애들은 가라~")
 		}		
}

function sum(){
		var su1=document.getElementById("s1");
		var su2=document.getElementById("s2");
		var o=document.getElementById("out");
		var r= Number(su1.value)+Number(su2.value);
		o.value=r;

		
}


</script>
</head>
<body>
	<input type='number' id='su' value='20'>
	<input type='button' value='확인'
		onclick='chk()'>
		
		
	<input type='number' id='s1' value='10'>
	+
	<input type='number' id='s2' value='20'>
	<input type='button' value='계산'
		onclick='sum()'>
	<input type='output' id='out'>

	
</body>
</html>